﻿using System;
using System.Web.Mvc;

using Ninject.Core;
using Ninject.Core.Parameters;

using BlueSky.Web.IoC;
using BlueSky.Web.Extentions;

namespace BlueSky.Web.IoC.Ninject
{
    internal class NinjectServiceResolver : IDependencyResolver
    {        
        public object Resolve(Type controllerServiceType)
        {
            return NinjectKernel.Kernel.Get(controllerServiceType);
        }

        public TControllerService Resolve<TControllerService>()
        {
            return (TControllerService)this.Resolve(typeof(TControllerService));
        }

        public void Release(object instance)
        {
            NinjectKernel.Kernel.Release(instance);
        }
    }
}
